package com.zb.internetSpider.entity;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableId;
import com.zb.internetSpider.gui.tree.utils.AbstractTreeNode;
import com.zb.internetSpider.gui.tree.utils.TreeNode;

/**
 * <p>
 * 
 * </p>
 *
 * @author zb
 * @since 2019-02-12
 */
public class Menu extends AbstractTreeNode implements Serializable, TreeNode {

    private static final long serialVersionUID = 1L;

    @TableId("MENU_ID")
    private String menuId;

    private String menuName;

    private Integer menuSort;

    private Integer menuLevel;

    private String menuParentId;
    
    private String menuIcon;


    public String getMenuId() {
        return menuId;
    }

    public void setMenuId(String menuId) {
        this.menuId = menuId;
    }

    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    public Integer getMenuSort() {
        return menuSort;
    }

    public void setMenuSort(Integer menuSort) {
        this.menuSort = menuSort;
    }

    public Integer getMenuLevel() {
        return menuLevel;
    }

    public void setMenuLevel(Integer menuLevel) {
        this.menuLevel = menuLevel;
    }

    public String getMenuParentId() {
        return menuParentId;
    }

    public void setMenuParentId(String menuParentId) {
        this.menuParentId = menuParentId;
    }

    public String getMenuIcon() {
		return menuIcon;
	}

	public void setMenuIcon(String menuIcon) {
		this.menuIcon = menuIcon;
	}

	@Override
    public String toString() {
        return "Menu{" +
        "menuId=" + menuId +
        ", menuName=" + menuName +
        ", menuSort=" + menuSort +
        ", menuLevel=" + menuLevel +
        ", menuParentId=" + menuParentId +
        "}";
    }

	@Override
	public String getId() {
		// TODO Auto-generated method stub
		return this.menuId;
	}

	@Override
	public void setId(String id) {
		// TODO Auto-generated method stub
		this.menuId = id;
	}

	@Override
	public String getpId() {
		// TODO Auto-generated method stub
		return this.menuParentId;
	}

	@Override
	public void setpId(String pId) {
		// TODO Auto-generated method stub
		this.menuParentId = pId;
	}

	@Override
	public Integer getLevel() {
		// TODO Auto-generated method stub
		return this.menuLevel;
	}

	@Override
	public void setLevel(Integer level) {
		// TODO Auto-generated method stub
		this.menuLevel = level;
	}

	@Override
	public Menu clone() {
		// TODO Auto-generated method stub
		Menu menu = null;
		try {
			menu = (Menu) super.clone();
		} catch (CloneNotSupportedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return menu;
	}

	@Override
	public Menu deepClone() {
		// TODO Auto-generated method stub
		Menu node = null;
		try {
			// 写入字节流
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			ObjectOutputStream obs = new ObjectOutputStream(out);
			obs.writeObject(this);
			obs.close();

			// 分配内存，写入原始对象，生成新对象
			ByteArrayInputStream ios = new ByteArrayInputStream(out.toByteArray());
			ObjectInputStream ois = new ObjectInputStream(ios);
			// 返回生成的新对象
			node = (Menu) ois.readObject();
			ois.close();
		} catch (IOException e) {
			// TODO: handle exception
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return node;
	}
}
